#!/bin/sh

mkdir -p ./lmk/$1/rank
mkdir -p ./lmk/$1/logcat

BASE_FOLDER=
cd ./lmk/$1;
echo '--------------------------------------------------'
BASE_FOLDER=`pwd`
echo 'cd '$BASE_FOLDER
echo '---------- To run procrank ----------'
echo 'i=0;while true;do echo "Saving :"$i".txt"; adb shell "echo \" TIME: \"\`date \"+%y%m%d%H%M%S\"\`" >>./rank/$i.txt;    adb shell "/data/procrank -u" >> ./rank/$i.txt;((i++));sleep 10;done'
echo '---------- To get kernel log ----------'
echo 'adb logcat -b kernel > ./all.log'
echo '---------- To format kernel log ----------'
echo 'grep -A 7 -e "lowmemorykiller: Killing"  all.log  > ./logcat/1.logg'
echo '--------------------------------------------------'

# i=0;while true;do echo "Saving :"$i".txt"; adb shell "echo \" TIME: \"\`date \"+%y%m%d%H%M%S\"\`" >>./rank/$i.txt;    adb shell "/data/procrank -u" >> ./rank/$i.txt;((i++));sleep 10;done
adb logcat -b kernel > ./all.log
# grep -A 7 -e "lowmemorykiller: Killing"  all.log  > ./logcat/1.log

